//
// Created by dcang on 2021/7/12.
//

#ifndef NDKDEMO_YCQUEUE_H
#define NDKDEMO_YCQUEUE_H
#include "queue"
#include "YcPlayStatus.h"
extern "C"
{
#include <libavcodec/avcodec.h>
#include "pthread.h"
};
class YcQueue {
public:
    std::queue<AVPacket*> queuePacket;
    std::queue<AVFrame*> queueFrame;
    pthread_mutex_t mutexFrame;
    pthread_cond_t condFrame;
    pthread_mutex_t mutexPacket;
    pthread_cond_t condPacket;
    YcPlayStatus *wlPlayStatus = NULL;

public:
    YcQueue(YcPlayStatus *playStatus);
    ~YcQueue();
    int putAvpacket(AVPacket *avPacket);
    int getAvpacket(AVPacket *avPacket);
    int clearAvpacket();
    int clearToKeyFrame();

    int putAvframe(AVFrame *avFrame);
    int getAvframe(AVFrame *avFrame);
    int clearAvFrame();

    void release();
    int getAvPacketSize();
    int getAvFrameSize();

    int noticeThread();
};


#endif //NDKDEMO_YCQUEUE_H
